package com.easy.service.impl;

import com.easy.bean.Pay;
import com.easy.mapper.PayDao;
import com.easy.service.PayService;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service


public class PayServiceImpl implements PayService {


    @Autowired
    PayDao payDao;
    @Override
    public Pay add(Pay pay) {
        payDao.add(pay);
        Pay result=payDao.one(pay.getId());
        return result;
    }

    @Override
    public int del(Integer id) {
        return payDao.del(id);
    }

    @Override
    public Pay edit(Pay pay) {
        payDao.edit(pay);
        Pay result=payDao.one(pay.getId());
        return result;
    }

    @Override
    public List<Pay> all(Pay pay) {
        return payDao.all(pay);
    }

    @Override
    public Pay one(Integer id) {
        return payDao.one(id);
    }

    @Override
    public void page(Page page, Pay pay) {
        int count = payDao.pageCount(pay);
        Object data=payDao.page(page, pay);
        page.setCount(count);
        page.setData(data);
    }
}
